//const {SyncHook} = require('tapable');
class SyncHook{
  constructor(args){
    this._args = args;//['name','age']
    this.taps = [];
  }
  tap(name,fn){
     this.taps.push(fn);
  }
  call(){
      let args = Array.from(arguments);
      this.taps.forEach(fn=>fn(...args.slice(0,this._args.length)));
  }

}
let hook = new SyncHook(['name']);
//hook.on();
hook.tap('1',(name,age)=>{
    console.log(1,name,age)
});
hook.tap('2',(name,age)=>{
    console.log(2,name,age)
});
//hook.emit();hook.trigger();
hook.call('zhufeng',10);

